<%--
  Created by IntelliJ IDEA.
  User: 王志斌
  Date: 2019/2/1
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    String static_path = path + "/static/alpha";
    String x_admin_path = path + "/static/X-admin-2.3";
    String h_path=path+"/static/H-ui";
%>
<html>
<head>
    <title>花名册管理</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

    <!-- X-admin -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <script type="text/javascript" src="<%=x_admin_path%>/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" href="<%=x_admin_path%>/css/font.css">
    <link rel="stylesheet" href="<%=x_admin_path%>/css/xadmin.css">
    <script type="text/javascript" src="<%=x_admin_path%>/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=x_admin_path%>/js/xadmin.js"></script>
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="<%=h_path %>/static/backstage/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="<%=h_path %>/static/backstage/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="<%=h_path %>/static/backstage/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="<%=h_path %>/static/backstage/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="<%=h_path %>/static/backstage/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <style type="text/css">
        #hot{
            color: red;
        }
        .select{
            height: 30px;
        }
    </style>

</head>


<body class="hold-transition sidebar-mini">
<div class="wrapper">
    <!-- 文件头 -->
    <jsp:include page="/manage/inc/head"></jsp:include>

    <!-- 侧边栏 -->
    <jsp:include page="/manage/inc/sidebar"></jsp:include>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>花名册管理</h1>
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>

        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <!-- Main content -->
                        <div class="invoice p-3 mb-3">

                            <div class="layui-row">

                                <div class="row">
                                    <div class="col-12 table-responsive" id="infoDiv">
                                        <table id="suibian" class="table table-border table-bordered table-bg table-hover table-sort" style="margin:0 auto">
                                            <thead>
                                            <tr >
                                                <th scope="col" colspan="10">员工花名册</th>
                                            </tr>
                                            <tr class="text-c">
                                                <th ><input type="checkbox" name="" value=""></th>
                                                <th width="100px">序号</th>
                                                <th width="70px">员工编号</th>
                                                <th width="100px">姓名</th>
                                                <th width="120px">性别</th>


                                                <th width="50px">职务</th>
                                                <th width="50px" >部门</th>
                                                <th width="50px">上级领导</th>

                                                <th width="50px" >操作</th>

                                            </tr>
                                            </thead>
                                            <tbody>
                                            <c:forEach items="${requestScope.userList}" var="list" varStatus="stat">
                                                <tr class="text-c">
                                                    <td><input type="checkbox" value="1" name="" id="select${list.id}"></td>
                                                    <td>${stat.count}</td>
                                                    <td>${list.jobNum}</td>
                                                    <td>${list.name}</td>
                                                    <td>${list.sex}</td>
                                                    <td>${list.post.postType}</td>
                                                    <td>${list.dt.departmentName}</td>
                                                    <td>${list.leader.name}</td>
                                                    <td>
                                                        <u style="cursor:pointer;text-decoration: none" class="text-primary" onclick="user_show('员工档案','<%=path%>/manage/roster/checkRecord?id=${list.id}','${list.id}','600','500')">查看</u>
                                                        <a title="删除"  onclick="user_del(this,  '${list.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">删除</i></a>
                                                    </td>
                                                </tr>
                                            </c:forEach>


                                            </tbody>
                                        </table>



                                    </div>
                                    <!-- /.col -->
                                    <%--<div id="page" style="margin-left:30%;"></div>--%>

                            </div>
                            <!-- /.invoice -->
                        </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.container-fluid -->
                <!-- /.content -->
            </div>
    </div>
        </section>

    <!-- AdminLTE App -->
    <script src="<%=static_path%>/dist/js/adminlte.min.js"></script>
    <!-- AdminLTE App -->
    <script src="<%=static_path%>/dist/js/adminlte.min.js"></script>

    <!--_footer 作为公共模版分离出去-->
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/layer.js"></script>
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/H-ui.min.js"></script>
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/H-ui.admin.js"></script>
    <!--/_footer 作为公共模版分离出去-->

    <!--请在下方写此页面业务相关的脚本-->

    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/WdatePicker.js"></script>
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="<%=h_path %>/static/backstage/js/laypage.js"></script>
    <script type="text/javascript">
        $('.table-sort').dataTable({
            "aaSorting": [[ 0, "asc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,]}// 不参与排序的列
            ]
        });
        //批量删除
        function datadel(){

            layer.confirm('确认要删除吗？',function(index){
                var ids="";

                var Id=[];

                $("input[id^=select]:checked").each(function(){

                    var id=$(this).attr("id").slice(6);
                    ids+=id+",";

                })
                if(ids.length>0)
                {
                    ids=ids.substring(0,ids.length-1);
                    Id= ids.split(",");

                }
                $.ajax({
                    url: "<%=path%>/manage/roster/batchDeleteUser",
                    data:{id:Id},
                    /* dataType: 'json', */
                    traditional: true,
                    success: function(){


                        for (var i = 0; i < Id.length; i++) {
                            $("#select"+Id[i]).parents("tr").remove();

                        }
                        layer.msg('已删除!',{icon:1,time:1000});
                    },

                });
            })
        }








        <%-- $.get("<%=path%>/background/homepage/provinceAndCity/batchDeleteCity",
                {id:ids},
                function(){
                     Id= ids.split(",");
                        for (var i = 0; i < Id.length; i++) {
                            $("#select"+Id[i]).parents("tr").remove();

                        }
                        layer.msg('已删除!',{icon:1,time:1000});

                }); --%>


        /*
            参数解释：
            title	标题
            url		请求的url
            id		需要操作的数据id
            w		弹出层宽度（缺省调默认值）
            h		弹出层高度（缺省调默认值）
        */
        /*人员-查看*/
        function user_show(title,url,id,w,h){
            layer_show(title,url,w,h);
        }
        /*城市-增加*/
        function city_add(title,url,w,h){
            layer_show(title,url,w,h);
        }
        /*用户-删除*/
        function user_del(obj,id){
            layer.confirm('确认要删除吗？',function(index){
                $.ajax({
                    type: 'POST',
                    url: '<%=path%>/manage/roster/deleteUser?id='+id,
                    dataType: 'json',
                    success: function(data){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    },
                    error:function(data) {
                        console.log(data.msg);
                    },
                });
            });
        }

        /*城市-编辑*/
        function city_edit(title,url,id,w,h){
            layer_show(title,url,w,h);
        }
        /*城市-停用*/
        function city_stop(obj,id){
            layer.confirm('确认要停用吗？',function(index){
                //此处请求后台程序，下方是成功后的前台处理……

                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
                $(obj).remove();
                layer.msg('已停用!',{icon: 5,time:1000});
            });
        }

        /*城市-启用*/
        function city_start(obj,id){
            layer.confirm('确认要启用吗？',function(index){
                //此处请求后台程序，下方是成功后的前台处理……


                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
                $(obj).remove();
                layer.msg('已启用!', {icon: 6,time:1000});
            });
        }
    </script>
</body>
</html>

